

from base.base import Base
from selenium.webdriver.common.by import By
from time import sleep

class SecondEditPage(Base):

    goodsmanager = (By.XPATH, '//span[text()="商场管理"]')
    def clickgoodsmanager(self):
        self.loc_ele(self.goodsmanager).click()

    generalprolem = (By.XPATH, '//span[text()="通用问题"]')
    def clickgeneralprolem(self):
        self.loc_ele(self.generalprolem).click()

    edit = (By.XPATH,"/html/body/div/div/div[2]/section/div/div[2]/div[3]/table/tbody/tr[1]/td[4]/div/button[1]")
    def clickedit(self):
        self.loc_ele(self.edit).click()

    proleminput = (By.CLASS_NAME, "el-input__inner")
    def inputprolemcontent(self, c):
        ele = self.loc_ele(self.proleminput)
        ele.clear()
        ele.send_keys(c)

    inputreply = (By.CLASS_NAME, "el-textarea__inner")
    def inputreplycontent(self, c):
        ele = self.loc_ele(self.inputreply)
        ele.clear()
        ele.send_keys(c)

    ensurebutton = (By.XPATH, '/html/body/div[1]/div/div[2]/section/div/div[4]/div/div[3]/div/button[2]/span')
    def clickensurebutton(self):
        self.loc_ele(self.ensurebutton).click()
        # 断言用到的元素

    dy = (By.CSS_SELECTOR, ' body>div.el-notification.right>div>div.el-notification__content>p')
    def getdycontent(self):
        return self.loc_ele(self.dy).text


    def secondedit(self,n,m):
        self.clickgoodsmanager()
        sleep(1)
        self.clickgeneralprolem()
        sleep(1)
        self.clickedit()
        self.inputprolemcontent(n)
        self.inputreplycontent(m)
        self.clickensurebutton()
        sleep(3)
